//
//  AddContentTableViewCell.m
//  MIDI
//
//  Created by 王禹丞 on 15/10/20.
//  Copyright (c) 2015年 QXSX. All rights reserved.
//

#import "AddContentTableViewCell.h"

@interface AddContentTableViewCell()<UITextFieldDelegate>

@property (weak, nonatomic) IBOutlet UITextField *nameTextField;

@property (weak, nonatomic) IBOutlet UITextField *contentTextField;

@end

@implementation AddContentTableViewCell

+(instancetype)cellWithTableView:(UITableView *)tableView{
    
    static NSString *ID = @"AddContentTableViewCell";
    
    AddContentTableViewCell  *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    
    if (cell == nil) {
        cell = [[[NSBundle mainBundle]loadNibNamed:@"AddContentTableViewCell" owner:nil options:nil]firstObject] ;
    }
    
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    
    return cell;
}

- (void)awakeFromNib{
    
    self.nameTextField.delegate = self;
    self.contentTextField.delegate = self;
    
    self.nameTextField.tag = 1;
    self.contentTextField.tag = 2;
}

//当textField编辑结束的时候
- (void)textFieldDidEndEditing:(UITextField *)textField{
    
    if ([self.delegate respondsToSelector:@selector(uploadAddContent:textFieldContent2:)]) {
        
        [self.delegate uploadAddContent:self.nameTextField.text textFieldContent2:self.contentTextField.text];
    }
}

@end










